﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ProjetoPeople.Models;

namespace ProjetoPeople.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/
        PeopleTattooEntities banco = new PeopleTattooEntities();

        public ActionResult Index()
        {
            var noticias = banco.noticias.Take(3).OrderByDescending(b => b.idnoticia);
            return View(noticias);
        }


        public FileContentResult RecuperarImagem(int id)
        {
            var imagem = banco.noticias.Single(a => a.idnoticia == id);
            return File(imagem.capa, "image/png");

        }

    }
}
